/**
 *
 * 快排
 *
 * Project: DataStructureAndArithmetic
 * Package: 
 * Version: 1.0
 *
 * Created by  WangJX  on 2020/2/7 10:49
 */
object QuickSort {

  /*
  :::(三个冒号)表示List的连接操作
  ::(两个冒号)表示普通元素与List的连接操作,::的运算规则从右向左
   */
  def quickSort(list: List[Int]): List[Int] = list match {
    case Nil => Nil
    case List() => List()
    case head :: tail =>
      val (left, right) = tail.partition(_ < head)
      quickSort(left) ::: head :: quickSort(right)
  }

  def main(args: Array[String]): Unit = {

  }

}
